import http from "@/api";
import { PORT1 } from "@/api/config/servicePort";
import { QuickMark } from "@/api/interface/detail";
import { Operation, ResPage } from "@/api/interface/index";
import qs from "qs";

/**
 * @name 组织机构模块
 */

// 获取部门列表
export const getDepartMentList = (params?: {}) => {
  return http.post<ResPage<Operation.ResDepartmentList>>(PORT1 + `/CoreCmsDepartment/GetPageList`, qs.stringify(params));
};

// 编辑部门
export const editDepartment = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsDepartment/DoEdit`, params);
};

// 创建部门
export const createDepartment = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsDepartment/DoCreate`, params);
};

// 删除部门
export const deleteDepartment = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsDepartment/DoDelete`, params);
};

// 获取组织机构列表
export const getOrganizationList = (params?: Operation.ResOrganizationList) => {
  return http.post<ResPage<Operation.ResOrganizationList>>(PORT1 + `/SysOrganization/GetPageList`, qs.stringify(params));
};

// 获取机构门店明细
export const getStoreOrganizationList = (params?: Operation.ResOrganizationList) => {
  return http.post<ResPage<Operation.ResOrganizationList>>(PORT1 + `/CoreCmsStoreOrganization/GetPageList`, qs.stringify(params));
};

// 获取未加入的门店明细
export const getNotJoinedStoreList = (params?: { organizationId: number }) => {
  return http.post<ResPage<Operation.ResOrganizationList>>(
    PORT1 + `/CoreCmsStoreOrganization/GetStoreList`,
    qs.stringify(params)
  );
};

// 添加门店到到机构
export const batchCreateStore = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStoreOrganization/DoBatchCreate`, params);
};
// 删除关联机构门店
export const deleteStoreorganization = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStoreOrganization/DoDelete`, params);
};

// 新增机构
export const createOrganization = (params: {}) => {
  return http.post(PORT1 + `/SysOrganization/DoCreate`, params);
};

// 编辑机构
export const editOrganization = (params: {}) => {
  return http.post(PORT1 + `/SysOrganization/DoEdit`, params);
};

// 删除机构
export const deleteOrganization = (params: {}) => {
  return http.post(PORT1 + `/SysOrganization/DoDelete`, params);
};

// 获取门店列表
export const getStoreList = (params?: {}) => {
  return http.post<ResPage<Operation.ResStoreList>>(PORT1 + `/CoreCmsStore/GetPageList`, qs.stringify(params));
};

// 创建门店
export const createStore = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStoreOrganization/DoCreate`, params);
};

// 编辑门店
export const editStore = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStore/DoEdit`, params);
};

// 删除门店
export const deleteStore = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStoreOrganization/DoDelete`, params);
};

// 获取员工列表
export const getStaffList = (params?: {}) => {
  return http.post<ResPage<Operation.ResStaffList>>(PORT1 + `/CoreCmsEmployee/GetPageList`, qs.stringify(params));
};

// 新建员工资料
export const createStaff = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsEmployee/DoCreate`, params);
};

// 编辑员工资料
export const editStaff = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsEmployee/DoEdit`, params);
};

// 删除员工资料
export const deleteStaff = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsEmployee/DoDelete`, params);
};

// 获取门店餐段
export const getStoreMarket = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStoreMarket/GetEdit`, qs.stringify(params));
};

// 门店餐段保存
export const editStoreMarket = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStoreMarket/DoCreate`, params);
};

// 获取服务商列表
export const getStoreGroupList = (params?: {}) => {
  return http.post<ResPage<Operation.ResStoreGroupList>>(PORT1 + `/CoreCmsStoreGroup/GetPageList`, qs.stringify(params));
};

// 获取商户列表
export const getGroupStoreList = (params?: {}) => {
  return http.post<ResPage<Operation.ResGroupStoreList>>(PORT1 + `/CoreCmsStore/GetGroupStoreList`, qs.stringify(params));
};

// 设置为服务商
export const setStoreGroup = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStoreGroup/SetStoreGroup`, params);
};

// 取消为服务商
export const cancelStoreGroup = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStoreGroup/CancelStoreGroup`, params);
};

// 签名短信审核
export const doSignCheck = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStore/DoSignCheck`, params);
};

// 服务商新增商户
export const createByGroup = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStore/DoCreateByGroup`, params);
};

// 编辑服务商资料
export const editStoreGroup = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsStoreGroup/DoEdit`, params);
};

// 云打印新建加载
export const getCloudPrintDetail = () => {
  return http.post<QuickMark.CloudPrintDetail>(PORT1 + `/corecmscloudprintdetail/getindex`);
};

// 新建二维码数量
export const createQuickMarkAPI = (params: {}) => {
  return http.post(PORT1 + `/corecmscloudprintdetail/CreateCode`, params);
};

// 美团授权
export const authorizationMeituanAPI = (params: {}) => {
  return http.post(PORT1 + "/Meituan/GetAuthUrl", params);
};
// 饿了么授权
export const authorizationElementAPI = (params: {}) => {
  return http.post(PORT1 + "/Eleme/GetAuthURL", params);
};

// 创建激活码
export const createActivationCodeAPI = (params: {}) => {
  return http.post(PORT1 + "/CoreCmsStore/DoCreateFacCode", params);
};
